<?php 
/**
 * Filter class file
 * @package Wordpress
 * @subpackage wp-dev
 */

/**
 * Trim '[...]' string from post excerpt
 * @param $content string
 * @return string
 */
function wpdev_trim_excerpt($content){
	return str_replace("[...]", "", $content);
}
add_filter('the_excerpt','wpdev_trim_excerpt');

/**
 * Remove meta tag generator from wordpress.
 * @param $meta string Meta tag generator 
 * @return string
 */
function wpdev_retire_wp_generator($meta){
	return '';
}
add_filter('the_generator','wpdev_retire_wp_generator');

/**
 * Prevents xhtml1.1 srtrict warning
 * @param $meta string Meta tag generator 
 * @return string
 */
function wpdev_extract_html_lang_attributes($attr){
	preg_match('/xml:lang="(.+)?"/', $attr, $xmlattr);
	
	return preg_replace('/lang="(.+)?"/', $xmlattr[0], $attr);
}
add_filter('language_attributes', 'wpdev_extract_html_lang_attributes');

/**
 * Add querystring for custom actions
 * @param $meta string Meta tag generator 
 * @return Array
 */
function wpdev_query_vars($public_query_vars) {
	$public_query_vars[] = "custom_action";
	return $public_query_vars;
}
add_filter('query_vars', 'wpdev_query_vars');